package com.mayqlzu.scrollviewevent;

import android.app.Application;
import android.content.pm.PackageManager;
import android.util.Log;

import com.alipay.euler.andfix.patch.PatchManager;

/**
 * Created by wangbh on 2017/10/19.
 */

public class MyApplication extends Application {
    private static MyApplication sAppContext = null;
    private PatchManager patchManager;
    public PatchManager getPatchManager() {
        return patchManager;
    }
    @Override
    public void onCreate() {
        super.onCreate();
        String versionName = null;
        try {
            versionName = this.getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
        Log.d("PatchDownload", "versionCode:"+versionName);
        sAppContext=this;
        patchManager = new PatchManager(this);
        patchManager.init("1.0");
        patchManager.loadPatch();

        //移入推送
       /* Intent patchDownloadIntent = new Intent(this, PatchDownloadIntentService.class);
        //http://kxapp.oss-cn-hangzhou.aliyuncs.com/fix%2Fdennis.apatch
        patchDownloadIntent.putExtra("url", "http://kxapp.oss-cn-hangzhou.aliyuncs.com/fix%2Fdennis.apatch");
        startService(patchDownloadIntent);*/
    }
    public static MyApplication getInstance() {
        return sAppContext;
    }
}
